/* 移动端专用样式文件 */

/* ===== 基础移动端适配 ===== */
@media (max-width: 768px) {
    /* 全局容器 */
    .container,
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* 页面标题 */
    h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    h3 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }
    
    /* 卡片布局 */
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        font-weight: 600;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* 表格优化 */
    .table-responsive {
        border: none;
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.875rem;
        margin-bottom: 0;
    }
    
    .table th {
        background-color: #f8f9fa;
        font-weight: 600;
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
        border-bottom: 2px solid #dee2e6;
        white-space: nowrap;
    }
    
    .table td {
        padding: 0.75rem 0.5rem;
        vertical-align: middle;
        white-space: nowrap;
    }
    
    /* 按钮组优化 */
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .btn-group .btn {
        flex: 1;
        min-width: auto;
        margin-bottom: 0.5rem;
    }
    
    .btn-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-toolbar .btn-group {
        margin-bottom: 0.5rem;
        margin-right: 0;
    }
    
    /* 表单优化 */
    .form-floating {
        margin-bottom: 1rem;
    }
    
    .form-control,
    .form-select {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 0.75rem;
        border-radius: 8px;
    }
    
    .form-label {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }
    
    .input-group {
        margin-bottom: 1rem;
    }
    
    .input-group-text {
        font-size: 0.875rem;
        padding: 0.75rem;
    }
    
    /* 模态框优化 */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 1rem;
        border-top: 1px solid #dee2e6;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    /* 标签页优化 */
    .nav-tabs {
        border-bottom: 2px solid #dee2e6;
        margin-bottom: 1rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        border: none;
        border-bottom: 2px solid transparent;
        background: none;
    }
    
    .nav-tabs .nav-link.active {
        border-bottom-color: #0d6efd;
        background: none;
        color: #0d6efd;
        font-weight: 600;
    }
    
    /* 进度条优化 */
    .progress {
        height: 1.5rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .progress-bar {
        font-size: 0.875rem;
        line-height: 1.5rem;
    }
    
    /* 警告框优化 */
    .alert {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
        font-size: 0.9rem;
    }
    
    .alert-dismissible .btn-close {
        padding: 1rem;
    }
    
    /* 分页优化 */
    .pagination {
        justify-content: center;
        margin-bottom: 1rem;
    }
    
    .page-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-width: 44px;
        text-align: center;
    }
    
    /* 面包屑优化 */
    .breadcrumb {
        padding: 0.75rem 0;
        margin-bottom: 1rem;
        font-size: 0.9rem;
        background: none;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        content: "›";
        font-size: 1.2rem;
    }
}

/* ===== 超小屏幕适配 (小于576px) ===== */
@media (max-width: 576px) {
    .container,
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .form-control,
    .form-select {
        padding: 0.625rem;
    }
    
    .modal-dialog {
        margin: 0.25rem;
        max-width: calc(100% - 0.5rem);
    }
    
    .modal-body {
        padding: 0.75rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* ===== 图表容器适配 ===== */
@media (max-width: 768px) {
    .chart-container {
        height: 300px !important;
        margin: 1rem 0;
        border-radius: 8px;
        overflow: hidden;
    }
    
    .chart-container canvas {
        border-radius: 8px;
    }
}

@media (max-width: 576px) {
    .chart-container {
        height: 250px !important;
        margin: 0.75rem 0;
    }
}

/* ===== 横屏模式适配 ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .chart-container {
        height: 200px !important;
    }
    
    .modal-body {
        max-height: 40vh;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
    }
}

/* ===== 触摸设备优化 ===== */
@media (hover: none) and (pointer: coarse) {
    /* 增大触摸目标 */
    .btn,
    .nav-link,
    .dropdown-item,
    .page-link,
    .list-group-item-action,
    .form-check-input,
    .form-check-label {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 优化表格行点击 */
    .table tbody tr {
        cursor: pointer;
    }
    
    .table tbody tr:hover {
        background-color: rgba(0,0,0,0.05);
    }
    
    /* 优化滚动 */
    .table-responsive,
    .modal-body,
    .offcanvas-body {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* 移除hover效果 */
    .btn:hover,
    .card:hover,
    .metric-card:hover {
        transform: none;
        box-shadow: inherit;
    }
}

/* ===== 特殊组件适配 ===== */
@media (max-width: 768px) {
    /* 指标卡片 */
    .metric-card {
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .metric-card .card-body {
        padding: 1rem 0.75rem;
    }
    
    .metric-card h5 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .metric-card .display-6 {
        font-size: 1.5rem;
        font-weight: 600;
    }
    
    .metric-card .text-muted {
        font-size: 0.8rem;
    }
    
    /* 股票信息卡片 */
    .stock-info {
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .stock-info .card-body {
        padding: 1.5rem 1rem;
    }
    
    /* 搜索框 */
    .search-container {
        margin-bottom: 1rem;
    }
    
    .search-container .input-group {
        margin-bottom: 0;
    }
    
    /* 筛选器 */
    .filter-container {
        margin-bottom: 1rem;
    }
    
    .filter-container .row > div {
        margin-bottom: 0.75rem;
    }
    
    /* 结果统计 */
    .result-stats {
        padding: 0.75rem;
        background-color: #f8f9fa;
        border-radius: 8px;
        margin-bottom: 1rem;
        font-size: 0.9rem;
    }
    
    /* 加载状态 */
    .loading {
        padding: 2rem;
        text-align: center;
    }
    
    .loading .spinner-border {
        width: 2rem;
        height: 2rem;
    }
    
    /* 空状态 */
    .empty-state {
        padding: 3rem 1rem;
        text-align: center;
        color: #6c757d;
    }
    
    .empty-state i {
        font-size: 3rem;
        margin-bottom: 1rem;
        opacity: 0.5;
    }
    
    .empty-state h5 {
        margin-bottom: 0.5rem;
    }
    
    .empty-state p {
        font-size: 0.9rem;
        margin-bottom: 0;
    }
}

/* ===== 自定义滚动条 ===== */
@media (max-width: 768px) {
    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }
    
    .table-responsive::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }
    
    .modal-body::-webkit-scrollbar {
        width: 6px;
    }
    
    .modal-body::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .modal-body::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 3px;
    }
}

/* ===== 深色模式适配 ===== */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .card {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .table {
        color: #e2e8f0;
        background-color: transparent;
    }
    
    .table th {
        background-color: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .table td {
        border-color: #718096;
    }
    
    .table-striped > tbody > tr:nth-of-type(odd) > td {
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    .form-control,
    .form-select {
        background-color: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .form-control:focus,
    .form-select:focus {
        background-color: #4a5568;
        border-color: #90cdf4;
        color: #e2e8f0;
        box-shadow: 0 0 0 0.2rem rgba(144, 205, 244, 0.25);
    }
    
    .modal-content {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .modal-header,
    .modal-footer {
        border-color: #4a5568;
    }
    
    .alert {
        background-color: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
}

/* ===== 高DPI屏幕优化 ===== */
@media (-webkit-min-device-pixel-ratio: 2) and (max-width: 768px),
       (min-resolution: 192dpi) and (max-width: 768px) {
    .card,
    .table,
    .btn,
    .form-control,
    .modal-content {
        border-width: 0.5px;
    }
    
    .table th,
    .table td {
        border-width: 0.5px;
    }
}

/* ===== 可访问性增强 ===== */
@media (prefers-reduced-motion: reduce) {
    .metric-card,
    .card,
    .btn {
        transition: none;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .navbar,
    .btn,
    .modal,
    .offcanvas,
    .dropdown-menu {
        display: none !important;
    }
    
    .container,
    .container-fluid {
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    
    .table {
        border-collapse: collapse !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
        padding: 0.5rem !important;
    }
} 